
#include "Graphic.h"

namespace Graphics
{
	Graphic::Graphic(void)
	{
	}

	Graphic::~Graphic(void)
	{
	}

	bool Comp(Renderable* const r1,Renderable* const r2)
	{
		return r1->GetSequence() < r2->GetSequence();
	}

	bool Graphic::RenderAll(void)
	{
		bool result = true;
		RenderMap map;

		for(RenderHash::iterator i = m_RenderHash.begin() ; i != m_RenderHash.end(); i++)
		{
			map.insert(*i);
			//result &= (*i).first->Render();
		}

		for(RenderMap::iterator i = map.begin() ; i != map.end(); i++)
		{
			result &= (*i).first->Render();
		}
		return result;
	}

	void Graphic::Add(Renderable* const obj)
	{
		if( obj == 0)
		{
			return;
		}
		m_RenderHash[obj];
		size_t a = m_RenderHash.size();
	}

	void Graphic::Remove(Renderable* const obj)
	{
		if( obj == 0)
		{
			return;
		}
		m_RenderHash.erase(obj);
	}
}